﻿using System;
using System.Windows.Data;
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Linq;

namespace ZFCNew.Converters
{
    public class FirstUrlConverter : IValueConverter
    {
        private const int defaultStringLength = 255;
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is IEnumerable<SyndicationLink> && ((IEnumerable<SyndicationLink>)value).Count() > 0)
            {
                return ((IEnumerable<SyndicationLink>)value).First().Uri;
            }
            return null;           
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
